package top.rainbowecho.article.vo;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.web.multipart.MultipartFile;
import top.rainbowecho.common.validate.NotBlankString;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author rainbow
 * @since 2020/3/30 15:12
 */
@Data
@EqualsAndHashCode
@Accessors(chain = true)
public class ArticleUploadVo {
    @NotBlankString(message = "文章封面图片URL不能为空")
    private String cover;

    /**
     * 用户id
     */
    @NotBlankString(message = "文章作者名不能为空")
    private String author;

    @NotNull(message = "上传的文章文件不能为空")
    private MultipartFile article;

    /**
     * 分类id
     */
    @NotBlankString(message = "文章分类不能为空")
    private String category;

    /**
     * 标签id数组
     */
    @NotEmpty(message = "文章标签不能为空")
    @Size(min = 1, max = 3, message = "文章标签最多三个，最少一个")
    private String[] tags;
}
